<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/include/head.jsp"%>
<div id="cc" class="easyui-layout" style="width:100%;height:100%;">   
	<div data-options="region:'center',title:'产品-${vo.name}信息'" style="padding:5px;background:#eee;">
		<form id="editForm"   method="post" enctype="multipart/form-data" >
			<input name="id" type="hidden" value="${vo.id}">
			<table cellpadding="0" cellspacing="1" class="formtable">
				<tr>
				<td align="right"><label class="Validform_label">产品编码:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="code" name="code"
				 data-options="required:true" value="${vo.code}" />
				</td>
				<td align="right"><label class="Validform_label">产品名称:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="name" name="name"
				 data-options="required:true" value="${vo.name}" />
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">进价:</label></td>
				<td class="value">
				<input class="easyui-numberbox" type="text"  id="pprice" name="pprice"
				 data-options="required:true,precision:2" value="${vo.pprice}" />
				</td>
				<td align="right"><label class="Validform_label">售价:</label></td>
				<td class="value">
				<input class="easyui-numberbox" type="text"  id="sprice" name="sprice"
				 data-options="required:true,precision:2" value="${vo.sprice}" />
				</td>
				
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">规格:</label></td>
				<td class="value">
				<textarea class="easyui-textbox" type="text" multiline="true"  id="spec" name="spec"
				 data-options="required:true,width:200"  >${vo.spec}</textarea>
				</td>
				<td align="right"><label class="Validform_label">材质:</label></td>
				<td class="value">
				<textarea class="easyui-textbox" type="text"  multiline="true" id="stuff" name="stuff"
				 data-options="required:true,width:200"  >${vo.stuff}</textarea>
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">单位:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="unit" name="unit"
				 data-options="required:true" value="${vo.unit}" />
				</td>
				<td align="right"><label class="Validform_label">货品标题:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="pName" name="pName"
				 data-options="required:true" value="${vo.pName}" />
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">开票标题:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="vouchName" name="vouchName"
				 data-options="required:true" value="${vo.vouchName}" />
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">状态:</label></td>
				<td class="value">
				<select id="status" class="easyui-combobox" name="status" style="width:200px;" data-options="required:true">  
					<option value="1" >启用</option>    
				    <option value="0" >禁用</option>   
				</select>
				</td>
				</tr>
			</table>
		</form>
	</div>
	<div data-options="region:'south'" style="height:35px;text-align: center;padding-top: 5px">
	 	<a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="save()" >保存</a>  
	 	<a id="btncancel" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="closeDialog()">关闭</a>  
	 </div>
</div>   
<script type="text/javascript">
var dialog = frameElement.dialog;
$(function() {
	$('#editForm').form({    
	    url:'saveOrUpdate.do',    
	    iframe:false,
	    onSubmit: function(){ 
	    	//do your things on submint
	    },    
	    success:function(data){    
	    	data = JSON.parse(data);
	    	if(data.result == '1')
	    	{
	    		$.messager.alert("保存结果","保存成功",'info',function(){
	    			if($.isFunction(dialog.dialog('options').callback))
	    			{
	    				dialog.dialog('options').callback(data);
	    			}
	    			closeDialog();
		    	});	
	    	}
	    	else
	    	{
	    		$.messager.alert("保存结果","保存失败：" + data.message,'error',function(){
	    			
		    	});
	    	}
	    }    
	});  
});

function save(){
	if(!$("#editForm").form('validate'))
	{
		$.messager.alert("验证结果","表单验证失败",'error',function(){
    	});
		return;
	}
	$("#editForm").submit();  
}
function closeDialog()
{
	dialog.dialog("close");
}

</script>
<%@include file="/include/foot.jsp"%>